ERROR:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and (video = false or video is NULL or (video = true and estado = 'procesado'))
' at line 4

QUERY STRING:
select galerias_img.id, galerias_img.galeria_id, galerias_img.archivo, galerias_img.ancho, galerias_img.alto, galerias_img.orden, galerias_img.video, galerias_img.estado, galerias_img.video_href
from galerias_img
where
	galeria_id =  and (video = false or video is NULL or (video = true and estado = 'procesado'))
order by orden asc, archivo asc, id asc